Skip to content

fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518)#22

Closed
aviruthen wants to merge 1 commit intomasterfrom
fix/pipeline-typeerror-can-only-concatenate-list-not-5518-2
Closed

fix: Pipeline TypeError: can only concatenate list (not "NoneType") to list Using Sou (#5518)#22
aviruthen wants to merge 1 commit intomasterfrom
fix/pipeline-typeerror-can-only-concatenate-list-not-5518-2

Conversation

@aviruthen
Copy link
Copy Markdown
Owner

Description

Fix TypeError when Pipeline.upsert() with SourceCode without requirements

Fixes aws#5518

Problem

When using SourceCode without setting requirements (which defaults to None) in a TrainingStep within a Pipeline, calling pipeline.upsert() could raise:

TypeError: can only concatenate list (not 'NoneType') to list

This occurs in get_processing_code_hash() where the dependencies parameter can be None but is used in list concatenation like [source_dir] + dependencies.

Fix

Added a defensive dependencies = dependencies or [] at the start of get_processing_code_hash() to ensure None dependencies are converted to an empty list before any list concatenation operations.

Testing

Added test cases for:

  • get_processing_code_hash with None dependencies (with and without source_dir)
  • get_training_code_hash with None dependencies (with source_dir and with entry_point only)
  • get_code_hash for TrainingStep when SourceCode.requirements is None

Related Issue

Fixes aws#5518

Changes Made

The bug occurs when SourceCode.requirements is not set (defaults to None) and a TrainingStep is used in a Pipeline. In get_code_hash(), source_code.requirements (which is None) is passed as dependencies to get_training_code_hash(). While the current get_training_code_hash() has if dependencies: guards, the get_processing_code_hash() function does NOT guard against None dependencies and directly concatenates [source_dir] + dependencies, which would fail with TypeError: can only concatenate list (not 'NoneType') to list. The fix is to default dependencies to an empty list at the start of get_processing_code_hash(), and add a similar defensive default in get_code_hash() when extracting requirements from SourceCode for the training step path.

AI-Generated PR

This PR was automatically generated by the PySDK Issue Agent.

  • Confidence score: 92%
  • Classification: bug
  • SDK version target: V3

Merge Checklist

  • Changes are backward compatible
  • Commit message follows prefix: description format
  • Unit tests added/updated
  • Integration tests added (if applicable)
  • Documentation updated (if applicable)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment right above your source code change explaining why you made that change?

@aviruthen aviruthen closed this Mar 23, 2026
@aviruthen aviruthen deleted the fix/pipeline-typeerror-can-only-concatenate-list-not-5518-2 branch March 23, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pipeline TypeError: can only concatenate list (not "NoneType") to list Using SourceCode

1 participant